#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

int main()
{
  pid_t id=fork();
  if(id==0)
  {
    int cnt=5;
    while(cnt--)
    {
      printf("I am child process,pid:%d,ppid:%d\n",getpid(),getppid());
      sleep(1);
    }
  }
  int status=0;
  pid_t rid=waitpid(id,&status,0);
  if(rid>0)
  {
    printf("wait success,rid:%d,status:%d\n",rid,status);
  }
  return 0;
}
